From 3358e0fe7f94b4f6bf8cdbaffa86693939e3fec5 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 17 Jun 2010 08:50:55 +0100 Subject: [PATCH] cpuidle: reduce redundant cost in cstate_restore_tsc for nonstop tsc Signed-off-by: Wei Gang --- xen/arch/x86/time.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index d500490254..3a824ec516 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -664,14 +664,17 @@ static void __init init_platform_timer(void) void cstate_restore_tsc(void) { - struct cpu_time *t = &this_cpu(cpu_time); - struct time_scale sys_to_tsc = scale_reciprocal(t->tsc_scale); + struct cpu_time *t; + struct time_scale sys_to_tsc; s_time_t stime_delta; u64 new_tsc; if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) ) return; + t = &this_cpu(cpu_time); + sys_to_tsc = scale_reciprocal(t->tsc_scale); + stime_delta = read_platform_stime() - t->stime_master_stamp; if ( stime_delta < 0 ) stime_delta = 0; -- 2.30.2